<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<script type="text/javascript">
	var comboData = {
		equipmentType:null,//设备类型
		deviceSupplier:null,//设备供应商
		equipmentInfoCombo:null,//设备基础信息
		equipmentCommTypeCombo:null,//通信类型
		residenceCombo:null,//小区
		buildingCombo:null,//楼栋
		buildingUnitCombo:null,//单元
		doorCombo:null,//门牌
		accountCombo:null,//平台用户
	}
	
	$(function() {
		
		$('#form').form({
			url : '/equipmentCommunController/add',
			onSubmit : function() {
				parent.$.messager.progress({
					title : '提示',
					text : '数据处理中，请稍后....'
				});
				var isValid = $(this).form('validate');
				if (!isValid) {
					parent.$.messager.progress('close');
				}
				return isValid;
			},
			success : function(result) {
				parent.$.messager.progress('close');
				result = $.parseJSON(result);
				if (result.success) {
					parent.$.modalDialog.openner_dataGrid.datagrid('reload');//之所以能在这里调用到parent.$.modalDialog.openner_treeGrid这个对象，是因为resource.jsp页面预定义好了
					parent.$.modalDialog.handler.dialog('close');
				}
			}
		});
		parent.$.messager.progress('close');

		
		//设备基础信息
		$.ajax({
			type:'post',
			url:'/deviceCommController/getEquipmentInfoComboData',
			data:{},
			success:function(result) {
				comboData.equipmentInfoCombo = result.equipmentInfoCombo;
				$('#equipmentInfoId').combobox({
					data : comboData.equipmentInfoCombo,
					valueField:'value',   
				    textField:'text',
				    panelHeight:'auto'
				});
			},
			dataType:'json'
		});
		
		//通信类型
		$.ajax({
			type:'post',
			url:'/deviceCommController/getDevCommTypeComboData',
			data:{},
			success:function(result) {
				comboData.equipmentCommTypeCombo = result.equipmentCommTypeCombo;
				$('#commType').combobox({
					data : comboData.equipmentCommTypeCombo,
					valueField:'value',   
				    textField:'text',
				    panelHeight:'auto'
				});
			},
			dataType:'json'
		});
		
	});
</script>
<div class="easyui-layout" data-options="fit:true,border:false">
	<div data-options="region:'center',border:false" title="" style="overflow: hidden;">
		<form id="form" method="post">
			<table class="table table-hover table-condensed">
				<tr>
					<th>设备基础信息</th>
					<td colspan="3"><input name="equipmentInfoId" id="equipmentInfoId" class="span2 " /></td>
				</tr>
				<tr>
					<th>通信类型</th>
					<td ><input name="commType"  id="commType" type="text" placeholder="请输入设备出厂编码"  data-options="required:true" ></td>
					<th>通信编码</th>
					<td ><input name="commCode" type="text" placeholder="请输入设备编码"  data-options="required:true" ></td>
				</tr>
				<tr>
					<th>设备位置</th>
					<td ><input name="address" type="text" placeholder="请输入设备出厂编码" class="easyui-validatebox span2" data-options="required:true" ></td>
					<th>通信状态</th>
					<td ><input type="radio" name="status" value="1">正常 &nbsp;<input type="radio" name="status"  value="2">冻结</td>
				</tr>
			</table>
		</form>
	</div>
</div>